<%@ page import="njust.edu.entity.Dish" %><%--
  Created by IntelliJ IDEA.
  User: 陈
  Date: 2021/9/17
  Time: 20:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <title>添加或修改菜品</title>
    <style>
        a:link {text-decoration:none;}
        a:visited {text-decoration:none;}
        a:hover {text-decoration:none;color: white}
        a:active {text-decoration:none;}
        p{
            font-family:georgia;
            font-weight: 400;
        }
        .header {
            font-size: 94%;
            opacity: 0.8;
            position: absolute;
            top: 0;
            width: 100%;
            height: 80px;
        }
        .header ul {
            list-style-type: none;
            background-color: #333;
            margin: 0;
            padding: 0;
            overflow: hidden;
            width: 100%;
            height: 80px;
        }

        .header li {
            float: left;
            height: 80px;
            width: 200px;
            font-size: 150%;
        }

        .header li a {
            display: block;
            color: white;
            text-align: center;
            padding: 30px;
            text-decoration: none;
            height: 80px;
        }

        .header li a {
            display: block;
            color: white;
            text-align: center;
            padding: 30px;
            text-decoration: none;
            height: 80px;
        }
        .container{
            position:absolute;
            width:1200px;
            height:1100px;
            padding-top: 10px;
            padding-left: 50px;
            top:80px;
            align-self: center;
            background-color: #dddce4;
            opacity: 0.8;
            border-radius: 45px/150px;
            left: 600px;
        }
        .edit_box{
            width:1100px;
            height: 960px;
            /*background-color: lightblue;*/
        }
        .edit_tip{
            width:140px;
            height: 60px;
            position: relative;
            float: left;
            padding-top: 10px;
            /*background-color: lightgray;*/
        }
        .edit_dishName{
            width:1100px;
            height: 60px;
        }
        .edit_dishID{
            width:1100px;
            height: 60px;
        }
        .edit_dishPrice{
            width:1100px;
            height: 60px;
        }
        .edit_dishIntroduce{
            width:1100px;
            height: 300px;
        }
        .edit_dishPictrue{
            width:1100px;
            height: 400px;
        }
        .input_dishName{
            margin-top: 5px;
            width: 300px;
            height: 50px;
            font-size: 200%;
        }

        .input_dishID{
            margin-top: 5px;
            width: 300px;
            height: 50px;
            font-size: 200%;
        }
        .input_dishPrice{
            float: left;
            position: relative;
            margin-top: 5px;
            width: 270px;
            height: 50px;
            font-size: 200%;
        }
        .input_dishitroduce{
            padding-top: 10px;
            float: left;
            position: relative;
            margin-top: 10px;
            width: 900px;
            height: 260px;
            font-size: 200%;
        }
        .choose_picture{
            width:520px;
            height: 120px;
            position: relative;
            float: left;
        }
        .previous_picture{
            float: left;
            position: relative;
        }
        .new_picture{
            float: left;
            position: relative;
            display: none;
        }

        .choose_mypicture{
            margin-top: 20px;
            margin-left: 160px;
            width: 200px;
            height: 50px;
        }
        .lastarea{
            width:520px;
            height: 100px;
            position: relative;
            float: left;
        }
        .load_picture{
            margin-top: 30px;
            margin-left: 170px;
            width: 180px;
            height: 80px;
            background-color: dodgerblue;
            border-radius: 25px;
            display: block;
            text-align: center;
            color: white;
            padding-top: 22px;
            font-size: 180%;
        }
        .confirm_box{
            float: left;
            width:1100px;
            height: 100px;
            position: relative;
            float: left;
        }
        .confirm_edit{
            float: left;
            position: relative;
            margin-left: 280px;
            margin-top: 10px;
            width: 180px;
            height: 80px;
            color: white;
            background-color: orangered;
            border-radius: 25px;
            display: block;
            text-align: center;
            font-weight: 900;
            font-size: 180%;
            border-style: none;
        }
        .quit_edit{
            float: left;
            position: relative;
            margin-left: 80px;
            margin-top: 10px;
            width: 180px;
            height: 80px;
            color: white;
            background-color: dimgrey;
            border-radius: 25px;
            display: block;
            text-align: center;
            padding-top: 22px;
            font-size: 180%;
        }
    </style>
    <%
        int state = (Integer)request.getAttribute("state");
        Dish dish = null;
        if (state==1)
            dish = (Dish)request.getAttribute("dish");
    %>
</head>
<body>
<div class = "backGround" style="position: relative;">
    <img src = "../img/item_manage.jpg" width="2402px" height="1202px">
<div class="header">
    <ul>
        <li><a href="BookController?method=itemManageUI"><p>管理菜品</p></a></li>
        <li><a href="TradeController?method=toTradeManageUI"><p>查看订单</p></a></li>
        <li><a href="UserController?method=toFinanceUI"><p>查看营业额</p></a></li>
        <li><a href="UserController?method=toSalaryUI" ><p>查看业绩</p></a></li>
        <li style="float: right"><a href="index.jsp" ><p>退出登录</p></a></li>
    </ul>
</div>

<div class = "container">
    <form action="BookController?method=<%=state==0?"addDish":"itemEdit"%>" method="post" accept-charset="UTF-8" >
    <div class = "edit_box">
        <div class = "edit_dishName">
            <div class = "edit_tip"><p style="font-size:200%">菜品名称:</p></div>
            <input type="text"  id = "dish_name" class = "input_dishName" name="name" placeholder=<%=(state==1)?dish.getName():""%> >
        </div>
        <div class = "edit_dishID">
            <div class = "edit_tip"><p style="font-size:200%">菜品编号:</p></div>
            <input type="text"  id = "dish_id" class = "input_dishID" name="id" placeholder=<%=(state==1)?dish.getId():""%>>
        </div>
        <div class = "edit_dishID">
            <div class = "edit_tip"><p style="font-size:200%">菜品类型:</p></div>
            <input type="text"  id = "dish_type" class = "input_dishID" name="type_id" placeholder=<%=(state==1)?dish.getType_id():""%>>
        </div>
        <div class = "edit_dishID">
            <div class = "edit_tip"><p style="font-size:200%">菜品库存:</p></div>
            <input type="text"  id = "dish_stock" class = "input_dishID" name="stock" placeholder=<%=(state==1)?dish.getStock():""%>>
        </div>
        <div class = "edit_dishPrice">
            <div class = "edit_tip"><p style="font-size:200%">菜品价格:</p></div>
            <input type="text"  id = "dish_price" class = "input_dishPrice" name="price" placeholder=<%=(state==1)?dish.getPrice():""%>>
            <div class = "edit_tip"><p style="font-size:200%">(元)</p></div>
        </div>
        <div class = "edit_dishIntroduce">
            <div class = "edit_tip"><p style="font-size:200%">菜品介绍:</p></div>
            <textarea   id = "dish_introduce" class = "input_dishitroduce" name="description" placeholder=<%=(state==1)?dish.getDescription():""%>>
            </textarea>
        </div>
        <div class = "edit_dishPictrue">
            <div class = "edit_tip" style="width: 520px; text-align: center;"><p style="font-size:200% ;">菜品图片:</p></div>
            <div class = "edit_tip" style="width: 520px; text-align: center;"><p style="font-size:200% ;">替换为下图:</p></div>
            <div class = "previous_picture">
                <img src = "../img/<%=(state==1)?dish.getPicture():""%>" width="520px" height="320px">
            </div>
            <div class = "new_picture">
                <img src = "img/2.jpg" width="520px" height="320px">
            </div>
            <div class = "choose_picture">
<%--                <input type="file" class = "choose_mypicture">--%>
                <a href="#" class = "load_picture"><p style="font-weight: 900;">加载图片</p></a>
            </div>
        </div>
    </div>
    <div class = "confirm_box">
        <div class = "lastarea" >
            <input type="submit" value="确定" class = "confirm_edit" id="edit">
        </div>
        <div class = "lastarea">
            <a href="#" class = "quit_edit"><p style="font-weight: 900;">退出编辑</p></a>
        </div>
    </div>
    </form>
</div>

</div>

<script type="text/javascript">
    window.onload=function()
    {
        var zx=document.getElementById("edit");
        zx.onclick=function()
        {
            alert("操作成功！");
        }
    }
</script>

</body>
</html>
